// 校验规则
export var Rule = function(object) {
  var self = object

  // 设置业务类校验规则
  this.setBusinessTypeIdsRules = function() {
    self.rules.businessTypeIds = [
      { required: true, message: '规则业务类不能为空', trigger: 'blur' },
      { required: true, message: '规则业务类不能为空', trigger: 'change' }
    ]
  }
  // 设置列号校验规则
  this.setColumnIndexRules = function() {
    self.rules.columnIndex = [
      { required: true, message: '列号不能为空', trigger: 'blur' },
      { required: true, message: '列号不能为空', trigger: 'change' }
    ]
  }
  // 设置列明校验规则
  this.setColumnNameRules = function() {
    self.rules.columnName = [
      { required: true, message: '列名不能为空', trigger: 'blur' },
      { required: true, message: '列名不能为空', trigger: 'change' }
    ]
  }
  // 设置表单名校验规则
  this.setSheetVariableNameRules = function() {
    self.rules.sheetVariableName = [
      { required: true, message: '表单名称不能为空', trigger: 'blur' },
      { required: true, message: '表单名称不能为空', trigger: 'change' }
    ]
  }
  // 设置生效日期校验规则
  this.setEffectiveDateRules = function() {
    self.rules.effectiveDate = [
      { required: true, message: '生效日期不能为空', trigger: 'blur' },
      { required: true, message: '生效日期不能为空', trigger: 'change' },
      { validator: self.validate.checkEffectiveDate, trigger: 'blur' },
      { validator: self.validate.checkEffectiveDate, trigger: 'change' }
    ]
  }
  // 设置实现日期校验规则
  this.setExpirationDateRules = function() {
    self.rules.expirationDate = [
      { required: true, message: '失效日期不能为空', trigger: 'blur' },
      { required: true, message: '失效日期不能为空', trigger: 'change' },
      { validator: self.validate.checkExpirationDate, trigger: 'blur' },
      { validator: self.validate.checkExpirationDate, trigger: 'change' }
    ]
  }
  // 设置实现方式校验规则
  this.setImplTypeRules = function() {
    self.rules.implType = [
      { required: true, message: '不能为空', trigger: 'blur' },
      { required: true, message: '不能为空', trigger: 'change' }
    ]
  }
  // 设置状态校验规则
  this.setRuleStatusRules = function() {
    self.rules.ruleStatus = [
      { required: true, message: '不能为空', trigger: 'blur' },
      { required: true, message: '不能为空', trigger: 'change' }
    ]
  }
  // 设置二次校验校验规则
  this.setSecondCheckRules = function() {
    self.rules.secondCheck = [
      { required: true, message: '不能为空', trigger: 'blur' },
      { required: true, message: '不能为空', trigger: 'change' }
    ]
  }
}
